package com.yulan.fastkillcourse;




import com.yulan.fastkillcourse.model.Course;
import com.yulan.fastkillcourse.redis.RedisService;
import com.yulan.fastkillcourse.redis.key.CourseKey;
import com.yulan.fastkillcourse.service.CourseService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Calendar;
import java.util.GregorianCalendar;

@SpringBootTest
public class testRedis {

    @Autowired
    RedisService redisService;

    @Autowired
    CourseService courseService;

    @Test
    public void testAddKey(){

        GregorianCalendar startTime = new GregorianCalendar();
        startTime.set(2020, Calendar.MARCH, 31,23,0,0);

        GregorianCalendar endTime = new GregorianCalendar();
        endTime.set(2020, Calendar.APRIL, 2,0,0,0);


        Course course = Course.builder()
                .startTime(startTime.getTime())
                .endTime(endTime.getTime())
                .name("软件工程")
                .teacherName("朱凯")
                .kind(1)
                .introduction("软件工程噢！！！")
                .build();


        redisService.set(CourseKey.getCourseList,"1",course,10);
        Course course1 = redisService.get(CourseKey.getCourseList,"1", Course.class);
        System.out.println(course1);
    }

    @Test
    public void testGetFastKillKey(){
    }


}
